//
//  HomeCollectionHeader.m
//  U_card
//
//  Created by 陈如意 on 2018/3/19.
//  Copyright © 2018年 陈如意. All rights reserved.
//

#import "HomeCollectionHeader.h"
#import "SDCycleScrollView.h"

@interface HomeCollectionHeader()<SDCycleScrollViewDelegate>

@property (nonatomic, strong) SDCycleScrollView * bannerCycle;//顶部的轮播图片


@end

@implementation HomeCollectionHeader

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initSubView];
    }
    return self;
}

- (void)initSubView{
    self.bannerCycle = [SDCycleScrollView cycleScrollViewWithFrame:self.frame imageNamesGroup:@[@"banner",@"banner2"]];
    self.bannerCycle.delegate = self;
    self.bannerCycle.autoScrollTimeInterval = 5.f;
    [self addSubview:self.bannerCycle];

}
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    if ([self.delegate respondsToSelector:@selector(didBannerAction:)]) {
        [self.delegate didBannerAction:index];
    }
}

@end
